#include "stm32f10x.h"
#include "Delay.h"
#include "OLED.h"
#include "MPU6050.h"


uint8_t ID;	// 定义用于存放 ID 号的变量
int16_t AX, AY, AZ, GX, GY, GZ; // 定义用于存放各个数据的变量

int main()
{
	/* 模块初始化 */
	OLED_Init();
	MPU6050_Init();

	/* 显示静态字符 */
	OLED_ShowString(1, 1, "ID:");
	ID = MPU6050_ID(); // 获取 MPU6050 的 ID 号
	OLED_ShowHexNum(1, 4, ID, 2);

	while (1)
	{
		MPU6050_GetData(&AX, &AY, &AZ, &GX, &GY, &GZ);
		/* OLED 显示数据 */
		OLED_ShowSignedNum(2, 1, AX, 5);
		OLED_ShowSignedNum(3, 1, AY, 5);
		OLED_ShowSignedNum(4, 1, AZ, 5);
		OLED_ShowSignedNum(2, 8, GX, 5);
		OLED_ShowSignedNum(3, 8, GY, 5);
		OLED_ShowSignedNum(4, 8, GZ, 5);
	}
}
